//背景随机图
function sj() {   
    var x = 0;
    var y = 5;
    var rand = parseInt(Math.random() * (x - y + 1) + y);
    return rand 
}
sj()

$(".enroll-beijing").css({
    "background": `url(img/4/${sj()}.jpg) no-repeat`,
    "background-size":"cover"

})



// 滑块

    $(document).ready(function () {
        var moveX, isMove = false, sliderWidth = $(".slider").width(), downX, outBoxWidth = $(".outBox").outerWidth(), outBoxLeft = $(".outBox").offset().left
        $(".slider").bind("mousedown", function (e) {
            downX = e.offsetX
            isMove = true
        })
        $(document).on("mousemove", function (e) {
            if (isMove) {

                moveX = e.pageX - outBoxLeft - downX

                if (moveX > outBoxWidth - sliderWidth) {
                    moveX = outBoxWidth - sliderWidth
                } else if (moveX < 0) {
                    moveX = 0
                }
                $(".slider").css("left", moveX)
                $(".slider_back").width(moveX)
            }
        })
        $(document).bind("mouseup", function () {
            isMove = false
            if (moveX == outBoxWidth - sliderWidth) {
                $("#remind").text("验证通过")
                $(".slider").html("&#10004;")
                $(".slider").unbind("mousedown")
                $(document).unbind("mouseup")
            } else if (moveX < outBoxWidth - sliderWidth) {
                $(".slider").css("left", 0)
                $(".slider_back").width('0')
            }
        })
    })


// 微信登录淡入淡出
    $(".weixin").click(function(){
        $(".denglu-tanchu").fadeIn(1000);
        $(".denglu-tanchu>div").animate({
            "margin-top": "300px"
        },1000) 
    })
    $(".denglu-tanchu").click(function(){
        $(".denglu-tanchu").fadeOut(1000);
        $(".denglu-tanchu>div").animate({
            "margin-top": "200px"
        },1000) 
    })


    $(".enroll-yiyou").click(function(){
        window.location.href="zhuce.html"
    })
 